package com.exam.controller;

import com.exam.handler.ImageHandler;
import com.exam.utils.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Api(tags = "图片管理")
@RestController
@RequestMapping(value = "/images")
public class ImageController {

    @Autowired
    private ImageHandler imageHandler;

    @PostMapping("/upload")
    @ApiOperation(value = "上传图片", notes = "上传图片")
    public ResultBody create(MultipartFile file) {
        return ResultBody.success(imageHandler.upLoad(file));
    }
}
